<div id="toast-container"></div>

<script>
  let errors = '<%- alerts.error %>'
  let successes = '<%- alerts.success %>'
  document.addEventListener('DOMContentLoaded', function() {
    if (errors) {
      M.toast({
        html: errors,
        classes: 'red lighten-2',
        displayLength: 2000
      })
    }

    if (successes) {
      M.toast({
        html: successes,
        classes: 'green lighten-2',
        displayLength: 2000
      })
    }
  })
</script>
